	function OnSubmitForm()
{
		var stillError = 0;
		var x;
	
		if(document.pressed == "Add Resident"){								
			if ( checkStudentNumber(document.residentform.student_number.value)== false) stillError++;
			if ( checkFirstName(document.residentform.first_name.value)== false) stillError++;
			if ( checkMiddleName(document.residentform.middle_name.value)== false) stillError++;
			if ( checkLastName(document.residentform.last_name.value)== false) stillError++;						
			if ( checkBirthday(document.residentform.birthday.value)== false) stillError++;									
			if ( checkReligion(document.residentform.religion.value)== false) stillError++;						
			if ( checkCourse(document.residentform.course.value)== false) stillError++;			
			if ( checkHomeAddress(document.residentform.home_address.value)== false) stillError++;		
			if ( checkTelephoneNumber(document.residentform.telephone_number.value, "telephone_number")== false) stillError++;			
			if ( checkEmailAddress(document.residentform.email_address.value)== false) stillError++;
			if ( checkFatherName(document.residentform.name_of_father.value)== false) stillError++;
			if ( checkMotherName(document.residentform.name_of_mother.value)== false) stillError++;
			if ( checkGuardianName(document.residentform.name_of_guardian.value)== false) stillError++;						
			if ( checkFatherContactNumber(document.residentform.telnumber_of_father.value)== false) stillError++;						
			if ( checkMotherContactNumber(document.residentform.telnumber_of_mother.value)== false) stillError++;						
			if ( checkGuardianContactNumber(document.residentform.telnumber_of_guardian.value)== false) stillError++;		
			
			x = document.getElementsByName("residentform_action");			
			document.residentform.action = x[0].value+document.residentform.student_number.value;			
			if(stillError > 0)
			{			
			    displayErrorAttention();					
				return false;					
			}else{
				return true;				
			}
		}else if(document.pressed == "Main Menu"){
			document.residentform.action ="loadAdminPageView";
			return true;
		}
}
